package cn.bone.springcloud.base.bean;

public class Ref {

    public static CommonResult<Void> ok(){
        CommonResult<Void> commonResult = new CommonResult();
        commonResult.setCode(0);
        commonResult.setMessage("成功");
        commonResult.setData(null);
        return commonResult;
    }

    public static CommonResult<Void> okMessage(String message){
        CommonResult<Void> commonResult = new CommonResult();
        commonResult.setCode(0);
        commonResult.setMessage(message);
        commonResult.setData(null);
        return commonResult;
    }

    public static <T> CommonResult<T> ok(T data){
        CommonResult<T> result = new CommonResult<>();
        result.setCode(0);
        result.setData(data);
        result.setMessage("成功");
        return result;
    }

    public static <T> CommonResult<T> okMessage(T data, String message){
        CommonResult<T> result = new CommonResult<>();
        result.setCode(0);
        result.setData(data);
        result.setMessage(message);
        return result;
    }

    public static <Void> CommonResult<Void> error(String message){
        CommonResult<Void> result = new CommonResult<>();
        result.setCode(3001);
        result.setData(null);
        result.setMessage(message);
        return result;
    }
}